import request from '@/router/axios';

// 库存中心
export const getStockCenter = (id) => {
  return request({
    url: 'api/mes-admin/area/select/dept',
    method: 'get',
    params: {
      id
    }
  });
};

export const getList = (current, size, params) => {
  return request({
    // /mes-warehouse/sheetheader/page
    // /mes-warehouse/material/page
    url: '/api/mes-warehouse/material/page',
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  });
};
export const sumQuantity = (params) => {
  return request({
    // /mes-warehouse/sheetheader/page
    // /mes-warehouse/material/page
    url: '/api/mes-warehouse/material/page/sum-quantity',
    method: 'get',
    params: {
      ...params,

    }
  });
};

// /mes-warehouse/receiving/undo-record

export const getListTable = (current, size, params) => {
  return request({
    url: '/api/mes-warehouse/receiving/undo-record',
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  });
};

export const getListData = (id) => {
  return Request({
    url: '/api/mes-warehouse/material/detail-list',
    method: 'get',
    params: {
      id
    }
  });
};

// /mes-warehouse/material/detail

export const getDetail = (params) => {
  return request({
    url: '/api/mes-warehouse/material/detail-list',
    method: 'get',
    params
  });
};

export const remove = (ids) => {
  return request({
    url: '/api/mes-warehouse/material/remove',
    method: 'post',
    params: {
      ids
    }
  });
};

export const add = (row) => {
  return request({
    url: '/api/mes-warehouse/material/submit',
    method: 'post',
    data: row
  });
};

export const update = (row) => {
  return request({
    url: '/api/mes-warehouse/material/submit',
    method: 'post',
    data: row
  });
};

/**
 * 获取库存中心信息
 */
export const getInventoryInfo = (params) => {
  return request({
    url: '/api/mes-admin/inventory/list',
    method: 'get',
    params
  });
}

export const getSnData = (packId) => {
  return request({
    url: '/api/mes-product/product/get-product-by-packid',
    method: 'get',
    params: {
      packId
    }
  });
};

export const getLockList = (current, size, params) => {
  return request({
    url: '/api/mes-warehouse/materiallockedobject/pageMaterialLockDetail',
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  });
};

export const areaInfo = (inventoryId) => {
  return request({
    url: '/api/mes-admin/area/select/inventory',
    method: 'get',
    params: {
      inventoryId
    }
  });
};

